package com.mayi.zds.dao;

import com.mayi.zds.entity.Label;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.mapping.FetchType;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author 刘宇涛
 * @Date 2019/12/25
 */
@Repository
public interface LabelDAO {
    /**
     * @Author 刘宇涛
     * @Description  根据商铺id查该商铺拥有的标签
     * @Date 14:51 2019/12/25
     * @Param [businessId]  商铺id
     * @return java.util.List<com.mayi.zds.entity.Label>    标签实体类集合
     **/
    @Select("select * from zds_label where business_id=#{businessId}")
    @Results(
            {
                    @Result(id = true,column = "id",property = "id"),
                    @Result(column = "id",property = "goodses",many = @Many(select = "com.mayi" +
                            ".zds.dao.GoodsDAO.getByLabelId",fetchType = FetchType.EAGER))
            }
    )
    public List<Label> getByBusinessId(String businessId);
}
